%activerow {
	&:hover {
		color: $white;
	}

	> .icon:first-child, > .icon.check {
		color: $theme-color;
	}
}

.sidebar {
	flex: 1 0 350px;
	width: 350px;
	transition: flex $transition-t ease-out;
	
	background: $darkest;
	display: flex;
	flex-direction: column;
	color: $light;
	
	border-right: 1px solid $darker;
	box-shadow: 1px 2px 8px $strong-shadow;
	z-index: 100;

	> .blocker {
		display: none;
	}
	
	.row, .list > li {
		display: flex;
		flex: 0 0 auto;
		padding: $pad/2;
		align-items: center;
		justify-content: center;
		border-bottom: 1px solid rgba($white, 0.06);
		transition: background $transition-t;
		color: $light;
		
		> * {
			margin: 0 $pad/2;
		}
		
		input, .label {
			flex: 1;
		}
		
		.icon {
			color: $dark;
		}
	}
	
	header.row {
		flex: 0 0 $title-height;
		padding: 0;

		.backrow {
			display: flex;
			flex: 1 0 auto;
			align-items: center;
			cursor: pointer;
			margin: 0;
			padding: $pad/2 0;
			
			.icon {
				flex: 0 0 auto;
				margin: 0 $pad;
			}

			&:hover {
				color: $white;
				.icon {
					color: currentColor;
				}
			}
		}

		.close.icon {
			padding: $pad*0.75 $pad;
			margin: 0;
		}
	}

	code {
		color: $white;
	}
	
	&.closed {
		flex: 0 $closed-sidebar-width;
	}
	
	> .min, > .full {
		.list {
			flex: 1 1 0%; // setting this and .content to 0% (instead of 50%) fixes issues in FireFox.
			display: flex;
			align-items: stretch;
			overflow-y: auto;
			background: $darker;
			border-bottom: 2px solid $darker;
			
			li, .row {
				@extend %link;
				color: $light;
				
				&:hover:not(.inactive) {
					background: mix($dark, $darker, 50);
					.token, .rating, .icon { color: currentColor; }
				}
				
				&.selected {
					background: $dark;
					color: $lighter;
					
					.token, .rating, .icon { color: currentColor; }
					&:hover {
						background: $dark;
						color: $white;
					}
				}
				
				&.disabled {
					pointer-events: none;
					opacity: $disabled-opacity;
				}

				&.link:not(.disabled) {
					overflow: hidden;
					.url {
						color: $theme-color;
						margin: 0;
					}
					&:hover {
						color:$white;
						.url {
							color: $white;
						}
					}
					.icon.copy {
						padding: $pad; /* easier to click */
						margin: -$pad 1.5*$pad -$pad -$pad;
						color: $dark;
						&:hover {
							color: $white;
						}
					}
				}
		
				&.active {
					@extend %activerow;
				}

				&.loading {
					padding: $pad;
					display: block;
					border: none;
					color: $mid;
					pointer-events: none;
				}
		
				.token {
					color: $mid;
					font-family: $monospace;
					font-weight: bold;
				}
				
				.rating {
					display: flex;
					align-items: center;
					color: $mid;
					font-size: 0.875em;

					.favorites.icon {
						color: $theme-color;
						padding: 0 $pad*0.25;
					}
				}
			}
		}
	}
	
	> .min {
		display: none;
		background: $darker;
		
		> .list > li:first-child {
			@extend %title;
			background: $darkest;
			padding: 0;
		}
	}
	
	> .full {
		display: flex;
		flex-direction: column;
		flex: 1;
		min-height: 0; // fix for Chrome 72+
		
		// states:
		&.no-search > .search {
			display: none;
		}
		
		&.no-list > .list {
			display: none;
		}
		
		> header {
			
			h1 {
				color: $white;
			}
			
			.icon {
				@extend %link;
				color: $dark;
			}
		}
		
		> .search {
			padding: 0 $pad/2;
			
			input {
				background: none;
				padding: 0;
				
				&:focus {
					border-bottom: 1px dotted $darker;
					margin-bottom: -1px;
				}
			}
			
			svg.icon {
				width: 1em;
				height: 1em;
				margin-right: 0.375em;
				
				&.search:hover {
					color: $white;
					cursor: pointer;
				}
				
				&.distractor {
					display: none;
				}
			}
			
			&.wait {
				svg.icon.search {
					display: none;
				}
				svg.icon.distractor {
					display: block;
				}
			}
		}
		
		> .content {
			flex: 1 1 0%;
			overflow-y: auto;
			overflow-x: hidden;
			padding: $pad;
			user-select: text;
			overflow-wrap: break-word;
			border-top: 2px solid $darkest;
			line-height: 1.4em;
			
			h1 {
				margin-top: 1.5em;
				color: $white;
			}
			
			code em {
				font-style: normal;
				background: $match-color;
				color: $white;
				margin-right: 1px;
			}
			
			b {
				color: $lighter;
			}

			ul {
				padding-left: 1.5em;
				margin-bottom: 0;
			}
		}

		> .hello {
			flex: 0 0 0;
			padding: 0;
			border: $pad*0.25 solid $black;
			background: $black;

			.noad {
				padding: $pad*0.75;
				color: $mid;

				b {
					color: $light;
				}
			}
		}
	}
}

#cheatsheet {
	table {
		width: 100%;
		
		th {
			@extend %link;
			text-align: left;
			background: $darker;
			padding: $pad/4 $pad/2;
			color: $theme-color;
		}

		tr + tr > th {
			border-top: $pad/2 solid $darkest;
		}

		td {
			padding: 0;

			&:first-child {
				font-family: $monospace;
			}
		}

		a {
			color: $white;

			&+a {
				margin-left: 0.375em;
			}
		}
	}
}